<?php 
		$data['__table']="";
		foreach($data['tables'] as $vo){
$data['__table'].=<<<topstr

	//{$vo[tname]}表操作
    public function {$vo[lowtname]}add(){
    	\$this->display();
    	
    }
    public function {$vo[lowtname]}addsave(){
    	\${$vo[lowtname]}=new {$vo[tname]}Model();
    	if(!\${$vo[lowtname]}->create()){
    		\$this->error(\${$vo[lowtname]}->getError());
    	}else{
    	\${$vo[key]}=\${$vo[lowtname]}->add();
    	\$this->assign("jumpUrl",U("{$data['acname']}/{$vo[lowtname]}content",array('{$vo[key]}'=>\${$vo[key]})));
    	\$this->success("添加成功");
    	}
    }
    public function {$vo[lowtname]}list(){
    	\${$vo[lowtname]}=new {$vo[tname]}Model();
        import("ORG.Util.Page");
        \$pagsize=15;
        \$totalnum=\${$vo[lowtname]}->count();
        \$list=\${$vo[lowtname]}->page(\$_GET['p'])->order('id desc')->limit($pagsize)->select();
        \$this->assign("list",\$list);
        \$page=new Page(\$totalnum,$pagsize);
        \$page->rollPage=$pagsize;    	
    	\$page->setConfig("prev","上一页");
    	\$page->setConfig("next","下一页");
    	\$page->setConfig("first","首页");
    	\$page->setConfig("last","末页");
    	\$page->setConfig("theme","共%totalRow%%header%条数据 %nowPage%/%totalPage%页  %first% %upPage%   %linkPage%  %downPage% %end%");
    	\$pageshow=\$page->show();
    	\$this->assign("pageshow",\$pageshow);
    	\$this->display();
    }
    public function {$vo[lowtname]}admin(){
    	\${$vo[lowtname]}=new {$vo[tname]}Model();
        import("ORG.Util.Page");
        \$totalnum=\${$vo[lowtname]}->count();
        \$list=\${$vo[lowtname]}->page(\$_GET['p'])->limit(10)->select();
        \$this->assign("list",\$list);
        \$page=new Page(\$totalnum,10);
        \$page->rollPage=10;
    	\$page->setConfig("header",\$header);
    	\$page->setConfig("prev","上一页");
    	\$page->setConfig("next","下一页");
    	\$page->setConfig("first","首页");
    	\$page->setConfig("last","末页");
    	\$page->setConfig("theme","共%totalRow%%header%条数据 %nowPage%/%totalPage%页  %first% %upPage%   %linkPage%  %downPage% %end%");
    	\$pageshow=\$page->show();
    	\$this->assign("pageshow",\$pageshow);
    	\$this->display();
    }
    public function {$vo[lowtname]}update(){
    	\${$vo[lowtname]}=new {$vo[tname]}Model();
    	\$data=\${$vo[lowtname]}->where("{$vo[key]}='{\$_GET['{$vo[key]}']}'")->find();
    	\$this->assign("data",\$data);
    	\$this->display();
    }
    public function {$vo[lowtname]}updatesave(){
    	\${$vo[lowtname]}=new {$vo[tname]}Model();
    	if(!\${$vo[lowtname]}->create()){
    		\$this->error(\${$vo[lowtname]}->getError());
    	}else{
    		\${$vo[lowtname]}->save();
    		\$this->success("修改成功");
    	}
    }
    public function {$vo[lowtname]}content(){
    	\${$vo[lowtname]}=new {$vo[tname]}Model();
    	\$data=\${$vo[lowtname]}->where("{$vo[key]}='{\$_GET['{$vo[key]}']}'")->find();
    	\$this->assign("data",\$data);
    	\$this->display();
    }
    public function {$vo[lowtname]}del(){
     \${$vo[lowtname]}=new {$vo[tname]}Model();
     if(!\${$vo[lowtname]}->delete(\$_GET['{$vo[key]}'])){
     	\$this->error("删除失败");
     }else{
     	\$this->success("删除成功");
     }
    }
    
topstr;
	    }
		
		